<?php
namespace Portal\Controller;

use Think\Controller;

class CityController extends Controller
{
    /**
     * 处理城市ajax请求
     */
    public function getCities()
    {
        $val = I('value');
        if ($val) {
            $cities = lt_get_city_by_province_id($val);
            $str = '';
            foreach ($cities as $city) {
                $str .= "<option value='" . $city['id'] . "'>" . $city['name'] . "</option>";
            }
            echo $str;
        }
    }

    /**
     * 处理区域ajax请求
     */
    public function getDistricts()
    {
        $val = I('value');
        if ($val) {
            $districts = lt_get_district_by_city_id($val);
            $str = '';
            foreach ($districts as $district) {
                $str .= "<option value='" . $district['id'] . "'>" . $district['name'] . "</option>";
            }
            echo $str;
        }
    }


}